using System;
using System.Collections.Generic;
using SouthernLand.Common.DAL.Contact;

namespace SouthernLand.Common.BOL.Contact
{
    public class Contact : BizObject
    {
        #region Public Properties

        public Int32 ContactID { get; set; }

        public Int32 CateID { get; set; }

        public String FullName { get; set; }

        public String Address { get; set; }

        public String Tel { get; set; }

        public String Email { get; set; }

        public String Title { get; set; }

        public String Content { get; set; }

        public DateTime AddedDate { get; set; }

        public Int32 ViewStatus { get; set; }

        #endregion

        #region public static Methods

        public static int Insert(Contact obj)
        {
            var db = new ContactDAL();
            return db.Insert(obj);
        }

        public static bool Update(Contact obj)
        {
            var db = new ContactDAL();
            return db.Update(obj);
        }

        public static bool Delete(Int32 ContactID)
        {
            var db = new ContactDAL();
            return db.Delete(ContactID);
        }

        public static Contact GetContactByID(Int32 ContactID)
        {
            var db = new ContactDAL();
            return db.GetContactByID(ContactID);
        }

        //Get All Contact
        public static List<Contact> GetAllContact(int PageIndex, int PageSize)
        {
            var db = new ContactDAL();
            return db.GetAllContact(PageIndex, PageSize);
        }

        // Get Count All records of Table  Contact
        public static int GetCountContact()
        {
            var db = new ContactDAL();
            return db.GetCountContact();
        }

        // Get ContactByCateID
        public static List<Contact> GetContactByCateID(Int32 CateID)
        {
            var db = new ContactDAL();
            return db.GetContactByCateID(CateID, 1, MAXROWS);
        }


        // Get ContactByCateID
        public static List<Contact> GetContactByCateID(Int32 CateID, int PageIndex, int PageSize)
        {
            var db = new ContactDAL();
            return db.GetContactByCateID(CateID, PageIndex, PageSize);
        }

        // Get ContactCountByCateID
        public static int GetContactCountByCateID(Int32 CateID)
        {
            var db = new ContactDAL();
            return db.GetContactCountByCateID(CateID);
        }

        #endregion
    }
}